//
//  OosContact.m
//  Oos4ios
//
//  Created by Pablo Gonzalez on 2/23/11.
//  Copyright 2011 11870.com. All rights reserved.
//

#import "OosContactEntry.h"
#import "OosElements.h"

@implementation OosContactEntry

- (void) addExtensionDeclarations
{
	[super addExtensionDeclarations];
	
	Class entryClass = [self class];
	
	[self addExtensionDeclarationForParentClass: entryClass childClasses:
	 // Oos extensions
	 [OosAvatar class], nil];
	
}

- (BOOL) trusted
{
	NSArray *trustedCats = [self categoriesWithScheme:@"http://api.11870.com/api/v2/trusted"];
	if ([trustedCats count] > 0) {
		GDataCategory *category = [trustedCats objectAtIndex:0];
		return [[category contentStringValue] isEqual:@"true"];
	}
	return FALSE;
}

- (NSString *) avatarUrl
{
	OosAvatar *avatar = [self objectForExtensionClass:[OosAvatar class]];
	return (avatar) ? [avatar stringValue] : nil;
}

- (NSString *) editUrl
{
	return [[self linkWithRelAttributeValue: @"edit"] href];
}

- (NSString *) userInfoUrl
{
	return [[self linkWithRelAttributeValue:@"user-info"] href];
}

@end
